package org.apereo.cas.ticket.registry;


import org.apereo.cas.ticket.ServiceTicket;
import org.apereo.cas.ticket.Ticket;
import org.apereo.cas.ticket.TicketGrantingTicket;
import org.apereo.cas.ticket.proxy.ProxyGrantingTicket;
import org.apereo.cas.ticket.proxy.ProxyTicket;

/**
 * @author chenkh
 * @time 2022/1/18
 */
public abstract class AbstractDistributedTicketRegistry extends AbstractTicketRegistry {
    public AbstractDistributedTicketRegistry() {
    }

    public abstract Ticket updateTicket(Ticket var1);

    protected abstract boolean needsCallback();

    protected final Ticket getProxiedTicketInstance(Ticket ticket) {
//        if (ticket == null) {
//            return null;
//        } else if (ticket instanceof ProxyGrantingTicket) {
//            return new ProxyGrantingTicketDelegator(this, (ProxyGrantingTicket)ticket, this.needsCallback());
//        } else if (ticket instanceof TicketGrantingTicket) {
//            return new TicketGrantingTicketDelegator(this, (TicketGrantingTicket)ticket, this.needsCallback());
//        } else if (ticket instanceof ProxyTicket) {
//            return new ProxyTicketDelegator(this, (ProxyTicket)ticket, this.needsCallback());
//        } else if (ticket instanceof ServiceTicket) {
//            return new ServiceTicketDelegator(this, (ServiceTicket)ticket, this.needsCallback());
//        } else {
//            throw new IllegalStateException("Cannot wrap ticket of type: " + ticket.getClass() + " with a proxy delegator");
//        }
        return ticket;
    }
}
